from multiprocessing import Pool


def say_hello(name):
    return f"Hello, {name}"


if __name__ == '__main__':
    # 创建一个新的进程池
    with Pool() as process_pool:
        # apply会出现阻塞 - 同步
        # 使用 apply_async实现异步
        hi_jeff = process_pool.apply(say_hello, args=("Jeff",))
        hi_john = process_pool.apply(say_hello, args=("John",))
        print(hi_jeff)
        print(hi_john)
